<template>
  <j-modal
    :title="title"
    :width="800"
    :visible="visible"
    :confirmLoading="confirmLoading"
    switchFullscreen
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">
    
    <a-spin :spinning="confirmLoading">
      <a-form-model ref="form" :model="model" :rules="validatorRules">
      
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="mandt" label="集团">
          <a-input placeholder="请输入集团" v-model="model.mandt" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="anln1" label="资产编号">
          <a-input placeholder="请输入资产编号" v-model="model.anln1" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="anln2" label="资产子编码">
          <a-input placeholder="请输入资产子编码" v-model="model.anln2" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="gjahr" label="年度">
          <a-input placeholder="请输入年度" v-model="model.gjahr" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="monat" label="期间">
          <a-input placeholder="请输入期间" v-model="model.monat" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ktogr" label="科目定位码

">
          <a-input placeholder="请输入科目定位码

" v-model="model.ktogr" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sernr" label="序列号">
          <a-input placeholder="请输入序列号" v-model="model.sernr" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="invnr" label="存货号">
          <a-input placeholder="请输入存货号" v-model="model.invnr" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="anlkl" label="资产分类
">
          <a-input placeholder="请输入资产分类
" v-model="model.anlkl" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="txk20" label="资产分类描述
">
          <a-input placeholder="请输入资产分类描述
" v-model="model.txk20" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="gsber" label="信用范围
">
          <a-input placeholder="请输入信用范围
" v-model="model.gsber" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="txt50" label="资产描述
">
          <a-input placeholder="请输入资产描述
" v-model="model.txt50" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="txa50" label="规格型号附加资产描述
">
          <a-input placeholder="请输入规格型号附加资产描述
" v-model="model.txa50" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="menge" label="数量">
          <a-input-number v-model="model.menge"/>
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="meins" label="单位

">
          <a-input placeholder="请输入单位

" v-model="model.meins" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ivdat" label="最后库存日
">
          <a-input placeholder="请输入最后库存日
" v-model="model.ivdat" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="invzu" label="补充库存说明
">
          <a-input placeholder="请输入补充库存说明
" v-model="model.invzu" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="aktiv" label="资产资本化日期
">
          <a-input placeholder="请输入资产资本化日期
" v-model="model.aktiv" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ord41" label="使用状态
">
          <a-input placeholder="请输入使用状态
" v-model="model.ord41" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ordt1" label="使用状态描述
">
          <a-input placeholder="请输入使用状态描述
" v-model="model.ordt1" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ord42" label="类别名称
">
          <a-input placeholder="请输入类别名称
" v-model="model.ord42" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ordt2" label="类别名称描述
">
          <a-input placeholder="请输入类别名称描述
" v-model="model.ordt2" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ord43" label="设备属性
">
          <a-input placeholder="请输入设备属性
" v-model="model.ord43" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ordt3" label="设备属性描述
">
          <a-input placeholder="请输入设备属性描述
" v-model="model.ordt3" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ord44" label="分类
">
          <a-input placeholder="请输入分类
" v-model="model.ord44" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ordt4" label="分类描述
">
          <a-input placeholder="请输入分类描述
" v-model="model.ordt4" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="gdlgrp" label="资产来源
">
          <a-input placeholder="请输入资产来源
" v-model="model.gdlgrp" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="herst" label="资产制造商
">
          <a-input placeholder="请输入资产制造商
" v-model="model.herst" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="eaufn" label="投资订单
">
          <a-input placeholder="请输入投资订单
" v-model="model.eaufn" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="kostl" label="成本中心
">
          <a-input placeholder="请输入成本中心
" v-model="model.kostl" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ltext" label="成本中心描述
">
          <a-input placeholder="请输入成本中心描述
" v-model="model.ltext" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="stort" label="资产地点
">
          <a-input placeholder="请输入资产地点
" v-model="model.stort" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="raumn" label="房间
">
          <a-input placeholder="请输入房间
" v-model="model.raumn" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xstil" label="资产停用
">
          <a-input placeholder="请输入资产停用
" v-model="model.xstil" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="anlhtxt" label="资产主号说明">
          <a-input placeholder="请输入资产主号说明" v-model="model.anlhtxt" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="afasl" label="折旧码
">
          <a-input placeholder="请输入折旧码
" v-model="model.afasl" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ndjar" label="计划年使用期
">
          <a-input placeholder="请输入计划年使用期
" v-model="model.ndjar" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ndper" label="计划使用期间
">
          <a-input placeholder="请输入计划使用期间
" v-model="model.ndper" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="afabg" label="折旧计算开始日期
">
          <a-input placeholder="请输入折旧计算开始日期
" v-model="model.afabg" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="schrw" label="资产残值
">
          <a-input-number v-model="model.schrw"/>
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ndabj" label="已使用年限
">
          <a-input-number v-model="model.ndabj"/>
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ndabp" label="已使用期限余月
">
          <a-input-number v-model="model.ndabp"/>
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="kansw" label="累积购置和生产费用
">
          <a-input-number v-model="model.kansw"/>
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="kaufw" label="重置价值的累计重估
">
          <a-input-number v-model="model.kaufw"/>
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="knafa" label="以前年度累计正常折旧
">
          <a-input-number v-model="model.knafa"/>
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="nafap" label="本年正常折旧
">
          <a-input-number v-model="model.nafap"/>
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="answl" label="该年度影响资产值的业务
">
          <a-input-number v-model="model.answl"/>
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zcyz" label="资产原值
">
          <a-input-number v-model="model.zcyz"/>
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ljzj" label="累计折旧
">
          <a-input-number v-model="model.ljzj"/>
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="dyzj" label="当月折旧
">
          <a-input-number v-model="model.dyzj"/>
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="nafag" label="本年折旧
">
          <a-input-number v-model="model.nafag"/>
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zcjcz" label="资产净残值
">
          <a-input-number v-model="model.zcjcz"/>
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="msehl" label="单位文本
">
          <a-input placeholder="请输入单位文本
" v-model="model.msehl" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zjz" label="净值
">
          <a-input placeholder="请输入净值
" v-model="model.zjz" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="liefe" label="供应商名称
">
          <a-input placeholder="请输入供应商名称
" v-model="model.liefe" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="lifnr" label="供应商编号
">
          <a-input placeholder="请输入供应商编号
" v-model="model.lifnr" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name1" label="供应商名称2
">
          <a-input placeholder="请输入供应商名称2
" v-model="model.name1" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="kostlv" label="责任成本中心
">
          <a-input placeholder="请输入责任成本中心
" v-model="model.kostlv" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ktext1" label="责任成本中心描述
">
          <a-input placeholder="请输入责任成本中心描述
" v-model="model.ktext1" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="caufn" label="内部订单
">
          <a-input placeholder="请输入内部订单
" v-model="model.caufn" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ktext2" label="内部订单描述
">
          <a-input placeholder="请输入内部订单描述
" v-model="model.ktext2" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="werks" label="工厂
">
          <a-input placeholder="请输入工厂
" v-model="model.werks" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name2" label="工厂描述
">
          <a-input placeholder="请输入工厂描述
" v-model="model.name2" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zzyear" label="当前已用年限
">
          <a-input placeholder="请输入当前已用年限
" v-model="model.zzyear" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zzmonth" label="当前已用月份
">
          <a-input placeholder="请输入当前已用月份
" v-model="model.zzmonth" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zstatus" label="状态">
          <a-input placeholder="请输入状态" v-model="model.zstatus" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bukrs" label="公司代码">
          <a-input placeholder="请输入公司代码" v-model="model.bukrs" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zdate" label="更新日期">
          <a-input placeholder="请输入更新日期" v-model="model.zdate" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ztime" label="更新时间">
          <a-input placeholder="请输入更新时间" v-model="model.ztime" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="requestid" label="流程ID">
          <a-input-number v-model="model.requestid"/>
        </a-form-model-item>
		
      </a-form-model>
    </a-spin>
  </j-modal>
</template>

<script>
  import { httpAction } from '@/api/manage'
  import moment from "moment"

  export default {
    name: "ZtbZfi011LogModal",
    data () {
      return {
        title:"操作",
        visible: false,
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },

        confirmLoading: false,
        validatorRules:{
        mandt:[{ required: true, message: '请输入集团!' }],
        anln1:[{ required: true, message: '请输入资产编号!' }],
        gjahr:[{ required: true, message: '请输入年度!' }],
        monat:[{ required: true, message: '请输入期间!' }],
        bukrs:[{ required: true, message: '请输入公司代码!' }],
        },
        url: {
          add: "/assets/ztbZfi011Log/add",
          edit: "/assets/ztbZfi011Log/edit",
        },
      }
    },
    created () {
    },
    methods: {
      add () {
        //初始化默认值
        this.edit({});
      },
      edit (record) {
        this.model = Object.assign({}, record);
        this.visible = true;
      },
      close () {
        this.$emit('close');
        this.visible = false;
        this.$refs.form.clearValidate();
      },
      handleOk () {
        const that = this;
        // 触发表单验证
         this.$refs.form.validate(valid => {
          if (valid) {
            that.confirmLoading = true;
            let httpurl = '';
            let method = '';
            if(!this.model.id){
              httpurl+=this.url.add;
              method = 'post';
            }else{
              httpurl+=this.url.edit;
               method = 'put';
            }
            httpAction(httpurl,this.model,method).then((res)=>{
              if(res.success){
                that.$message.success(res.message);
                that.$emit('ok');
              }else{
                that.$message.warning(res.message);
              }
            }).finally(() => {
              that.confirmLoading = false;
              that.close();
            })
          }else{
             return false;
          }
        })
      },
      handleCancel () {
        this.close()
      },


    }
  }
</script>

<style lang="less" scoped>

</style>